package com.ruoyi.recommend.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.recommend.mapper.GoodsRecommendMapper;
import com.ruoyi.recommend.domain.GoodsRecommend;
import com.ruoyi.recommend.service.IGoodsRecommendService;

/**
 * 商品推荐Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-15
 */
@Service
public class GoodsRecommendServiceImpl implements IGoodsRecommendService 
{
    @Autowired
    private GoodsRecommendMapper goodsRecommendMapper;

    /**
     * 查询商品推荐
     * 
     * @param recommendId 商品推荐主键
     * @return 商品推荐
     */
    @Override
    public GoodsRecommend selectGoodsRecommendByRecommendId(Long recommendId)
    {
        return goodsRecommendMapper.selectGoodsRecommendByRecommendId(recommendId);
    }

    /**
     * 查询商品推荐列表
     * 
     * @param goodsRecommend 商品推荐
     * @return 商品推荐
     */
    @Override
    public List<GoodsRecommend> selectGoodsRecommendList(GoodsRecommend goodsRecommend)
    {
        return goodsRecommendMapper.selectGoodsRecommendList(goodsRecommend);
    }

    /**
     * 新增商品推荐
     * 
     * @param goodsRecommend 商品推荐
     * @return 结果
     */
    @Override
    public int insertGoodsRecommend(GoodsRecommend goodsRecommend)
    {
        goodsRecommend.setCreateTime(DateUtils.getNowDate());
        return goodsRecommendMapper.insertGoodsRecommend(goodsRecommend);
    }

    /**
     * 修改商品推荐
     * 
     * @param goodsRecommend 商品推荐
     * @return 结果
     */
    @Override
    public int updateGoodsRecommend(GoodsRecommend goodsRecommend)
    {
        goodsRecommend.setUpdateTime(DateUtils.getNowDate());
        return goodsRecommendMapper.updateGoodsRecommend(goodsRecommend);
    }

    /**
     * 批量删除商品推荐
     * 
     * @param recommendIds 需要删除的商品推荐主键
     * @return 结果
     */
    @Override
    public int deleteGoodsRecommendByRecommendIds(Long[] recommendIds)
    {
        return goodsRecommendMapper.deleteGoodsRecommendByRecommendIds(recommendIds);
    }

    /**
     * 删除商品推荐信息
     * 
     * @param recommendId 商品推荐主键
     * @return 结果
     */
    @Override
    public int deleteGoodsRecommendByRecommendId(Long recommendId)
    {
        return goodsRecommendMapper.deleteGoodsRecommendByRecommendId(recommendId);
    }
}
